package com.qixiaobao.web.controller.system;

import com.qixiaobao.common.annotation.Log;
import com.qixiaobao.web.controller.core.controller.BaseController;
import com.qixiaobao.common.core.domain.AjaxResult;
import com.qixiaobao.common.core.domain.entity.SysUser;
import com.qixiaobao.common.enums.BusinessType;
import com.qixiaobao.system.service.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Description 用户信息
 * @Author yangxm
 * @Date 2025/6/16 11:23
 */
@RestController
@RequestMapping("/system/user")
public class SysUserController extends BaseController {

    @Autowired
    private ISysUserService userService;

    /**
     * @Description 修改密码
     * @Author yangxm
     * @Date 2025/6/16 11:27
     * @param sysUser
     * @return com.qixiaobao.common.core.domain.AjaxResult
     */
    @Log(title = "用户管理", businessType = BusinessType.UPDATE)
    @PutMapping("/updatePassword")
    public AjaxResult changePassword(@RequestBody SysUser sysUser){
        return toAjax(userService.changePassword(sysUser.getUsername(), sysUser.getOldPassword(), sysUser.getNewPassword()));
    }
}
